import {
	// createMemoryHistory,
	createRouter,
	createWebHistory
} from 'vue-router'

import HomeView from '../pages/home/index.vue'
import AboutView from '../pages/about/index.vue'
import CaseView from '../pages/case/index.vue'
import DetailsView from '../pages/case/caseDetails.vue'
import DesignerView from '../pages/designer/index.vue'
import DesignerDetailView from '../pages/designer/detail.vue'
import newsView from '../pages/news/index.vue'
import NewDetailView from '../pages/news/NewDetail.vue'

const routes = [{
		path: '/',
		name: 'home',
		component: HomeView
	}, {
		path: '/about',
		name: 'about',
		component: AboutView
	}, {
		path: '/case',
		name: 'case',
		component: CaseView
	}, {
		path: '/caseDetails',
		name: 'caseDetails',
		component: DetailsView
	}, {
		path: '/designer',
		name: 'designer',
		component: DesignerView
	},
	{
		path: '/designerDetail',
		name: 'designerDetail',
		component: DesignerDetailView
	},
	{
		path: '/news',
		name: 'news',
		component: newsView
	},
	{
		path: '/newsDetail',
		name: 'newsDetail',
		component: NewDetailView
	},
]

const router = createRouter({
	history: createWebHistory(),
	routes,
})
// BAD
router.beforeEach((to, from, next) => {
	// if (to.name !== 'Login' && !isAuthenticated) next({
	// 	name: 'Login'
	// })
	// 如果用户未能验证身份，则 `next` 会被调用两次
	next()
})
export default router;